package com.game.centerserver.service;

import com.game.centerserver.pojo.result.DSTServerProcessView;
import com.game.centerserver.pojo.result.HttpStateCodeResult;
import com.game.centerserver.pojo.result.ServerStateView;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.util.List;

/**
 * (TUser)表服务接口
 *
 * @author makejava
 * @since 2024-10-29 16:07:01
 */
public interface HttpClientService {

    /**
     * 获取所有服务列表
     *
     * @param ip
     * @param port
     * @return
     */
    HttpStateCodeResult<List<DSTServerProcessView>> getServerStateList(String ip, Integer port);

    /**
     * 通过存档id开启存档
     *
     * @param ip
     * @param port
     * @param archiveID 存档ID
     * @param shard     何种世界地图（地上、洞穴）
     * @return
     */
    HttpStateCodeResult<String> startServerByArchiveID(String ip, Integer port, String archiveID, String shard);

    /**
     * 获取服务器状态
     *
     * @param ip
     * @param port
     * @return
     */
    HttpStateCodeResult<ServerStateView> getSystemState(String ip, Integer port);

    /**
     * 召回通过文档ID
     *
     * @param ip
     * @param port
     * @param archiveID
     * @return
     */
    HttpStateCodeResult<byte[]> callBackServerByArchiveID(String ip, Integer port, String archiveID);

    /**
     * 召回确认
     *
     * @param ip
     * @param port
     * @param archiveID
     * @return
     */
    HttpStateCodeResult<String> ackCallBackServer(String ip, Integer port, String archiveID);

    /**
     * 通过存档id关闭服务
     *
     * @param ip
     * @param port
     * @param archiveID
     * @return
     */
    HttpStateCodeResult<String> shutdownServer(String ip, Integer port, String archiveID);

        /**
     * 通过存档id关闭服务
     *
     * @param ip
     * @param port
     * @param
     * @return
     */
    HttpStateCodeResult<String> shutdownAllServer(String ip, Integer port);

    /**
     * 构建新服务
     * @param ip
     * @param port
     * @param shard
     * @param memry_limit 单位MB
     * @param cpu_limit
     * @param archiveId
     * @param file
     * @return
     */
    HttpStateCodeResult<String> buildNewServer(String ip, Integer port, 
        Integer memry_limit, double cpu_limit, String archiveId,
        File file) ;

    /**
     * 更新饥荒服务器, 调用前保证服务器上没有运行的进程服务
     *
     * @param ip
     * @param port
     * @return
     */
    HttpStateCodeResult<String> updateDST(String ip, Integer port);

}
